import { createRouter, createWebHistory } from 'vue-router'
import Books from "@/views/Books.vue"
import Layout from "@/views/Layout.vue";

const router = createRouter({
  history: createWebHistory(),
  routes: [
    // {
    //   path: '/books',
    //   name: 'home',
    //   component: Books,
    // },
    {
      path: '/books',
      component: Layout,
      children: [
        {
          path: '',
          name: 'home',
          component: Books,
        },
        // 其他路由配置...
      ]
    },
    {
      path:'/details',
      name:'details',
      component: ()=> import("@/views/BookDetails.vue")
    },
    {
      path:'/delete',
      name:'delete',
      component: Books,
    },
    {
      path:'/update',
      name:'update',
      component:() => import("@/views/BookUpdate.vue")
    },
    {
      path:'/add',
      name:'add',
      component:() => import("@/views/BookAdd.vue"),
      meta:{requiresPermission: 'book:add'}
    },
    {
      path:'/',
      name:'Login',
      component:() => import("@/views/Login.vue")
    },
    {
      path:'/register',
      name:'Register',
      component:() => import("@/views/Register.vue")
    },
    {
      path:'/system/userList',
      name:'UserList',
      component:() => import("@/views/system/UserList.vue")
    },
    {
      path:'/index',
      name:'Index',
      component:() => import("@/views/index.vue")
    },
    
  ],
})

export default router
